package com.openlogic.j.completion;

import java.util.Date;
import java.util.Map;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;

/**
 * @ClassName: CompletionResponse
 * @Description: 响应结束参数实体
 * @author weiyongpeng
 * @date 2025年2月21日 下午4:57:33
 */
@JsonDeserialize(builder = CompletionResponse.Builder.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class CompletionResponse {

	@JsonProperty
	private String code;
	@JsonProperty
	private String message;
	@JsonProperty
	private Object data;
	@JsonProperty
	private Date timestamp;
	
	private CompletionResponse(Builder builder) {
        this.code = builder.code;
        this.message = builder.message;
        this.data = builder.data;
        this.timestamp = builder.timestamp;
    }
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getData() {
		return data;
	}
	public void setData(Map<String, Object> data) {
		this.data = data;
	}
	public Date getTimestamp() {
		return timestamp;
	}
	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}
	@Override
	public String toString() {
		return "CompletionResponse [code=" + code + ", message=" + message + ", data=" + data + ", timestamp="
				+ timestamp + "]";
	}
	@Override
	public int hashCode() {
		return Objects.hash(code, data, message, timestamp);
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CompletionResponse other = (CompletionResponse) obj;
		return Objects.equals(code, other.code) && Objects.equals(data, other.data)
				&& Objects.equals(message, other.message) && Objects.equals(timestamp, other.timestamp);
	}

	public static Builder builder() {
        return new Builder();
    }
	
	@JsonPOJOBuilder(withPrefix = "")
    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
    public static final class Builder {

		private String code;
		private String message;
		private Object data;
		private Date timestamp;

        private Builder() {
        }

        public Builder code(String code) {
            this.code = code;
            return this;
        }

        public Builder message(String message) {
            this.message = message;
            return this;
        }

        public Builder data(Object data) {
            this.data = data;
            return this;
        }

        public Builder timestamp(Date timestamp) {
        	this.timestamp = timestamp;
            return this;
        }


        public CompletionResponse build() {
            return new CompletionResponse(this);
        }
    }

}
